// 应用常量定义

// API相关常量
export const API_CONFIG = {
    BASE_URL: '/api/1.0.0/platform/ghy/way',
    TIMEOUT: 10000,
    SUCCESS_CODES: [0, 200],
};

// 刷新间隔常量（秒）
export const REFRESH_INTERVALS = {
    FAST: 30,       // 30秒
    NORMAL: 300,    // 5分钟
    SLOW: 600,      // 10分钟
    VERY_SLOW: 1800, // 30分钟
};

// 页面路由常量
export const ROUTES = {
    DASHBOARD: '/dashboard',
    DATA_QUERY: '/data-query',
    DEVICE_MANAGEMENT: '/device-management',
    SAMPLE_MANAGEMENT: '/sample-management',
    THEME_DEMO: '/theme-demo',
    TAB_DEMO: '/tab-demo',
};

// 主题相关常量
export const THEME_CONFIG = {
    LIGHT: 'light',
    DARK: 'dark',
    AUTO: 'auto',
};

// 表格分页配置
export const PAGINATION_CONFIG = {
    DEFAULT_PAGE_SIZE: 10,
    PAGE_SIZE_OPTIONS: ['10', '20', '50', '100'],
    SHOW_SIZE_CHANGER: true,
    SHOW_QUICK_JUMPER: true,
    SHOW_TOTAL: (total, range) =>
        `第 ${range[0]}-${range[1]} 条/共 ${total} 条`,
};

// 设备状态常量
export const DEVICE_STATUS = {
    ONLINE: 'online',
    OFFLINE: 'offline',
    MAINTENANCE: 'maintenance',
    ERROR: 'error',
};

// 设备状态颜色映射
export const DEVICE_STATUS_COLORS = {
    [DEVICE_STATUS.ONLINE]: '#52c41a',
    [DEVICE_STATUS.OFFLINE]: '#d9d9d9',
    [DEVICE_STATUS.MAINTENANCE]: '#faad14',
    [DEVICE_STATUS.ERROR]: '#ff4d4f',
};

// 信号强度等级
export const SIGNAL_LEVELS = {
    EXCELLENT: -50,  // > -50dBm
    GOOD: -60,       // -50 ~ -60dBm
    FAIR: -80,       // -60 ~ -80dBm
    POOR: -100,      // -80 ~ -100dBm
    // < -100dBm 为很差
};

// 信号强度颜色
export const SIGNAL_COLORS = {
    EXCELLENT: '#52c41a',
    GOOD: '#52c41a',
    FAIR: '#faad14',
    POOR: '#ff4d4f',
    VERY_POOR: '#f5222d',
};

// 错误消息
export const ERROR_MESSAGES = {
    NETWORK_ERROR: '网络连接失败，请检查网络状态',
    TIMEOUT_ERROR: '请求超时，请检查网络连接',
    SERVER_ERROR: '服务器内部错误',
    UNAUTHORIZED: '未授权访问',
    FORBIDDEN: '访问被拒绝',
    NOT_FOUND: '请求的资源不存在',
    BAD_REQUEST: '请求参数错误',
    UNKNOWN_ERROR: '未知错误',
};

// 本地存储键名
export const STORAGE_KEYS = {
    USER_ID: 'userId',
    THEME_MODE: 'themeMode',
    LAYOUT_TYPE: 'layoutType',
    TAB_HISTORY: 'tabHistory',
    USER_PREFERENCES: 'userPreferences',
};
